import Vue from 'vue';
import VueRouter from 'vue-router';
import layuot from '../views/layuot/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: "/frontPage/frontPage",
    // eslint-disable-next-line no-undef
  },
  {
    path: "/frontPage",
    name: "frontPage",
    redirect: '/frontPage/frontPage',
    component: layuot,
    children: [
      {
        path: '/frontPage/frontPage',
        name: "frontPage2",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "frontPage" */ "../views/FrontPage/index.vue"),
      },
      {
        path: '/frontPage/winery',
        name: 'winery',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "winery" */ '../views/FrontPage/AboutUs/winery.vue')
      },
      {
        path: '/frontPage/idea',
        name: 'idea',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "idea" */ '../views/FrontPage/AboutUs/idea.vue')
      },
      {
        path: '/frontPage/certificate',
        name: 'certificate',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "certificate" */ '../views/FrontPage/AboutUs/certificate.vue')
      },
    ]
  },
  {
    path: '/myus',
    name: 'myus',
    component: layuot,
    children: [
      {
        path: "myus",
        name: "Myus",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "Myus" */ "../views/Myus/Myus.vue"),
      },
    ]
  },
  {
    path: '/product',
    name: 'product',
    component: layuot,
    children: [
      {
        path: 'product',
        name: 'Product',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "Product" */ "../views/Product/Product.vue"),
      },
      {
        path: 'paperback',
        name: 'paperback',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "paperback" */ "../views/Product/paperback.vue"),
      },
      {
        path: 'hardcover',
        name: 'hardcover',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "hardcover" */ "../views/Product/hardcover.vue"),
      },
    ]

  },
  {
    path: '/microvision',
    name: 'microvision',
    component: layuot,
    children: [
      {
        path: "microvision",
        name: "Microvision",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "Microvision" */ "../views/Microvision/Microvision.vue"),
      },
    ]
  },
  {
    path: '/sealtheAltar',
    name: 'sealtheAltar',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: layuot,
    children: [
      {
        path: "sealtheAltar",
        name: "SealtheAltar",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "SealtheAltar" */ "../views/SealtheAltar/SealtheAltar.vue"),
      },
      {
        path: "formulate",
        name: "formulate",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "formulate" */ "../views/SealtheAltar/formulate.vue"),
      },
    ]
  },

  {
    path: '/WineCellar',
    name: 'Winecellar',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "Winecellar" */ '../views/WineCellar/Winecellar.vue')
  },
  {
    path: '/Join',
    name: 'Join',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "Winecellar" */ '../views/Join/Join.vue')
  },
  {
    path: '/mall',
    name: 'mall',
    component: layuot,
    children: [
      {
        path: 'mall',
        name: 'Mall',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "Mall" */ '../views/Mall/Mall.vue')
      }
    ]
  },
  {
    path: '/Connect',
    name: 'Connect',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "Winecellar" */ '../views/Connect/Connect.vue')
  },
  {
    path: '/News',
    name: 'News',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "News" */ '../views/News/News.vue')
  },
  {
    path: '/paperback',
    name: 'paperback2',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "paperback" */ '../views/Product/paperback.vue')
  },
  {
    path: '/hardcover',
    name: 'hardcover2',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "hardcover" */ '../views/Product/hardcover.vue')
  },
  {
    path: '/Activity',
    name: 'Activity',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "Activity" */ '../views/Activity/Activity.vue')
  },

  {
    path: '*',
    name: 'page404',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "page404" */ '../views/page404/index.vue')
  }
]

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  routes
})

export default router

